package com.test.store;

public class StoreProxy implements com.test.store.Store {
  private String _endpoint = null;
  private com.test.store.Store store = null;
  
  public StoreProxy() {
    _initStoreProxy();
  }
  
  private void _initStoreProxy() {
    try {
      store = (new com.test.store.StoreServiceLocator()).getStore();
      if (store != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)store)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)store)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (store != null)
      ((javax.xml.rpc.Stub)store)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.test.store.Store getStore() {
    if (store == null)
      _initStoreProxy();
    return store;
  }
  
  public int deliver(int id, int num) throws java.rmi.RemoteException{
    if (store == null)
      _initStoreProxy();
    return store.deliver(id, num);
  }
  
  
}